package com.sbio.udiapp.net.exception;


import io.reactivex.functions.Consumer;

public abstract class ErrorConsumer<T> implements Consumer<Throwable> {
    @Override
    public void accept(Throwable throwable) {
        ApiException ex;
        if (throwable instanceof ApiException) {
            ex = (ApiException) throwable;
        } else {
            ex = ApiException.handleException(throwable);
        }
        error(ex);
    }

    public abstract void error(ApiException ex);


}
